package com.bjb.vr.remote.ws.rabbitmq.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Component
public class IpConfiguration {
    private String port;

    private String ip;

    @Autowired
    Environment environment;

    public String getPort(){
        this.port = environment.getProperty("server.port");
        return port;
    }

    public IpConfiguration (){
        try {
            this.ip = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

    public String getIp() {
        return ip;
    }

}
